package edu.sctu.practice.class01.huangtianlin.assign6.guava;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;

/**
 * Created by Administrator on 2015/11/26.
 */
public class Manhua {

    public static void main(String[] args) {



        try {

            for (int i = 1; i < 20; i++) {

                String ss = String.valueOf(i);

                if(100/i >10){

                    ss =  "00"+ss;
                }else if(100/i >1){

                    ss = "0"+ss;
                }



            URL url   =   new   URL( "http://tkpic.tukucc.com/4700/20140924/c_169578/"+ss+".jpg");

            URLConnection uc   =   url.openConnection();

            InputStream is   =   uc.getInputStream();

            File file   =   new   File( "D:\\manhua\\"+i+".jpg ");

            FileOutputStream out   =   new   FileOutputStream(file);

            int   j=0;

            while   ((j=is.read())!=-1)   {

                out.write(j);

            }

            is.close();


            }

        } catch (IOException e) {
            e.printStackTrace();
        }


    }


}
